package com.tuanzi.blog.dao;

import com.tuanzi.blog.model.Blog;
import com.tuanzi.blog.model.BlogWithBLOBs;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface BlogMapper {
    int deleteByPrimaryKey(Long id);

    int insert(BlogWithBLOBs record);

    int insertSelective(BlogWithBLOBs record);

    BlogWithBLOBs selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(BlogWithBLOBs record);

    int updateByPrimaryKeyWithBLOBs(BlogWithBLOBs record);

    //查询所有博客
    List<BlogWithBLOBs> selectAll();

    //下面写重载方法，用于条件查询
    List<BlogWithBLOBs> getList(BlogWithBLOBs blog);

    int selectTypeCounts(@Param("typeId")Long typeId);

    //查询按时间排序的n条数据
    List<BlogWithBLOBs> getTimeBlogs(@Param("size") int size);

    List<BlogWithBLOBs> searchBlogByTitleOrContent(@Param("title")String title);

    //根据类型查询博客
    List<BlogWithBLOBs> selectByType(@Param("id") Long id);

    //查询博客中所有日志的年份
    List<String> getYears();

    //根据年份查询所有博客
    List<BlogWithBLOBs> selectByYear(@Param("year") String year);

    //查询数据库总所有博客总数
    Long selectCount();

}